export const Compare = function (obj1: any, obj2: any) {
  let obj1Keys = Object.keys(obj1);
  let obj2Keys = Object.keys(obj2);
  // 属性名数量是否一样
  if (obj1Keys.length !== obj2Keys.length) {
    return false;
  }
  // 判断属性名是否一样
  for (let i = 0; i < obj1Keys.length; i++) {
    if (obj1Keys[i] !== obj2Keys[i]) {
      return false;
    }
  }

  for (let i = 0; i < obj1Keys.length; i++) {
    const key = obj1Keys[i];

    if (typeof obj1[key] === "object") {
      if (!Compare(obj1[key], obj2[key])) {
        return false;
      }
    } else {
      if (obj1[key] !== obj2[key]) {
        return false;
      }
    }
  }

  return true;
};

